<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>  

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>展览管理</title>
    <c:set var="contextPath" value="${pageContext.request.contextPath}" scope="request"/>
	<link rel="stylesheet" href="${contextPath}/static-resources/css/index.css"/>
	<script src="${contextPath}/static-resources/jquery-1.12.1.js"></script>
	<script src="${contextPath}/static-resources/js/index.js"></script>
	
	<link rel="stylesheet" type="text/css" href="${contextPath}/static-resources/themes/material/easyui.css">
	<link rel="stylesheet" type="text/css" href="${contextPath}/static-resources/themes/icon.css">
	<script type="text/javascript" src="${contextPath}/static-resources/jquery.min.js"></script>
	<script type="text/javascript" src="${contextPath}/static-resources/jquery.easyui.min.js"></script>
	<script type="text/javascript">
		function openUpload(){
			$('#addWindow').window('open');
		}
		
		function remove(){
			
		}
		function upload(){
			var fileInputId = $('#fileBox').next().find('input[type="file"]').attr("id");
	        var file = document.getElementById(fileInputId).files[0];
	        var reader = new FileReader();
            reader.onload = function (e) {
                var base64stream = this.result;
                var dataObj = new Object();
                dataObj.fileName = file.name;
                dataObj.base64stream = base64stream;
                $.ajax({
                    type: "POST",
                    url: '${contextPath}/production/add.do',
                    enctype: 'multipart/form-data',
                    data: dataObj,
                    success: function (data) {
        	            console.log(data);
        	        }, error: function () {
        	        	
        	        }
                });
            };
            reader.readAsDataURL(file);
		}
	</script>
</head>
<body style="height: 100%;">
	<div class="find_nav">
	    <div class="find_nav_left">
	        <div class="find_nav_list">
	            <ul>
	                <li class="find_nav_cur"><a href="javascript:void(0)">展览</a></li>
	                <li><a href="javascript:void(0)">作品</a></li>
	                <li><a href="javascript:void(0)">图片</a></li>
    	            <li><a href="javascript:void(0)">分类</a></li>
	                <li class="sideline"></li>
	            </ul>
	        </div>
	    </div>
	</div>
	<div id="content" style="width: 100%; position: absolute;top: 45px;">
		<table id="dg" class="easyui-datagrid" title="图片" style="width:100%;height:100%;"
			data-options="rownumbers:true, singleSelect:true, url:'datagrid_data1.json', method:'get',
			toolbar:'#tb' " >
			<thead>
				<tr>
					<th data-options="field:'ck', checkbox:true"></th>
					<th data-options="field:'itemid', width:200">作品名称</th>
					<th data-options="field:'productid', width:200">作者</th>
					<th data-options="field:'listprice', width:300">标签</th>
				</tr>
			</thead>
		</table>
		
		<div id="tb">
			<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="openUpload()">上传图片</a>
			<a href="#" class="easyui-linkbutton" iconCls="icon-cut" plain="true" onclick="remove">删除</a>
		</div>
		
		<div id="addWindow" class="easyui-window" title="上传作品" data-options="iconCls:'icon-save', collapsible:'false', modal:'true', closed:true, footer:'#footer'" style="width:500px; height:350px; padding:10px;" buttons="#addWindow-buttons" >
			<div style="width: 100%;">
				<input class="easyui-textbox" data-options="label: '作品名称：', labelPosition:'before'" name="name" id="name" style="width: 100%"/>
			</div>
		
			<div style="width: 100%; margin-top: 5px;">
				<input class="easyui-combobox" name="author" style="width:100%" data-options="
					url: '${contextPath}/user/userList.do',
					method: 'post',
					valueField: 'id',
					textField: 'name',
					panelWidth: 350,
					panelHeight: 'auto', 
					labelWidth: '%', label: '作者：', labelPosition: 'before' ">
			</div>
			<div style="width: 100%; margin-top: 5px;">
				<input class="easyui-filebox" id="fileBox" style="width:100%;" data-options="label:'选择作品：', labelPosition:'before', buttonText:'请选择...' ">
			</div>
		</div>
		<div id="footer" class="windowFooter">
			<a href="#" class="easyui-linkbutton" icon="icon-ok" onclick="upload()">确定</a>  
            <a href="#" class="easyui-linkbutton" icon="icon-cancel" onclick="$('#addWindow').window('close')">退出</a>  
		</div>

	</div>
</body>


</html>